# coding=utf-8

import unittest
from common.mch.handler import notify_mch, construct_notify_data
from common.order import db as order_db
from common.order.handler import retry_push_failed

SUCCESS = 2
MANUAL_SUCCESS = 4

class test_notify(unittest.TestCase):
    def test_notify_mch_success(self):
        order = notify_mch('1672326307342475264')
        self.assertEqual(MANUAL_SUCCESS, order[1].status)

    def test_construct_notify_data_success(self):
        pay = order_db.get_order(1672326307342475264)
        data = construct_notify_data(pay)
        self.assertEqual(SUCCESS, data['pay_result'])

    def test_retry_push_failed_success(self):
        retry_push_failed()
        self.assertTrue(True)

if __name__ == '__main__':
    unittest.main()
